package com.zhao.fishingguideserver.service.impl;

import com.zhao.fishingguideserver.POJO.Product;
import com.zhao.fishingguideserver.mapper.ProductMapper;
import com.zhao.fishingguideserver.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品服务实现类
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return productMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Product product) {
        return productMapper.insert(product);
    }

    @Override
    public int insertSelective(Product record) {
        return productMapper.insertSelective(record);
    }

    @Override
    public Product selectByPrimaryKey(Long id) {
        return productMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Product> selectAll() {
        return productMapper.selectAll();
    }

    @Override
    public List<Product> selectAvailable() {
        return productMapper.selectAvailable();
    }

    @Override
    public int updateByPrimaryKeySelective(Product record) {
        return productMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Product record) {
        return productMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Product> selectByUserId(Integer userId) {
        return productMapper.selectByUserId(userId);
    }

    @Override
    public List<Product> searchProducts(String keyword, Integer minPrice, Integer maxPrice, Integer oldLevel) {
        return productMapper.searchProducts(keyword, minPrice, maxPrice, oldLevel);
    }

    @Override
    public List<Product> selectByOldLevel(Integer oldLevel) {
        return productMapper.selectByOldLevel(oldLevel);
    }
}
